package datamining.code.processtable;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

/*Merge names and last names*/
public class ProcessNames {
	
	public static void main(String[] args) {
		String linha = null; //tupla inteira
		String dados[]; //array de atributos da tupla
		try {
			
			File input = new File("csvtables/beforeprocessing/fakenames.csv");
			FileReader fileReader = new FileReader(input);
			BufferedReader bufferedReader = new BufferedReader(fileReader);
			
			File output = new File("csvtables/afterprocessing/fakenames.csv");
			FileWriter fileWriter = new FileWriter(output);
			BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
			
			while((linha=bufferedReader.readLine())!=null) {
				dados=linha.split(";");
				linha=dados[1]+" "+dados[2]+"\n";
				bufferedWriter.write(linha);
			}
			bufferedWriter.flush();
			bufferedWriter.close();
			
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}


	}

}
